<script setup lang="ts">
import { storeToRefs } from 'pinia'
import { useFinanceStore } from '@/stores/module/finance'
import { watch, computed, ref } from 'vue'
import FinanciaBarTarget from '@/components/Echart/Bar/FinanciaBarTarget.vue'
import { useDialogStore } from '@/stores/dialog'
const dialogStore = useDialogStore()
const { dialogInfo } = dialogStore
const dialogInfoVisible = dialogInfo.visible
const financeStore = useFinanceStore() // 创建store实例
const { getGlobalVariableExpensesCumulativeYear }: any =
  storeToRefs(financeStore)

const options = computed(() => {
  return {
    name: 'getGlobalVariableExpensesCumulativeYear',
    xAxis: {
      type: 'category',
      data: getGlobalVariableExpensesCumulativeYear.value.sub_titles,
    },
    data: getGlobalVariableExpensesCumulativeYear.value.info,
  }
})
</script>
<template>
  <card-box
    :moreBtn="{
      show: true,
      position: 'right',
      transition: 'left',
      childTitle: $t('bi_finance_variationalexpenditureoverview'),
      pName: 'l-box',
    }"
    componentName="CumulativeExpenseStart"
  >
    <template v-slot:child>
      <CumulativeExpenseStart
        :moreBtn="{
          show: false,
        }"
      />

      <VariableExpensesCost />
      <VariableExpensesWages />
      <VariableExpensesAgencyfee />
      <VariableExpensesTax />
      <VariableExpensesPromotion />
    </template>

    <template v-slot:title>
      <h1>{{ getGlobalVariableExpensesCumulativeYear?.title }}</h1>
    </template>
    <FinanciaBarTarget
      v-if="getGlobalVariableExpensesCumulativeYear?.info?.length"
      :chartData="options"
    />
  </card-box>
</template>
<style lang="scss" scoped>
.default-img {
  width: 100%;
  text-align: center;
  padding: 120px 0;
  background-image: url('@/assets/images/canvsimage/default.png');
  background-repeat: no-repeat;
  background-position: center;

  font-size: 16px;
  color: #00f6ff;
}
.subtitle {
  font-size: 30px;
}
</style>
